import request from '@/utils/request.js'
import api from './apis.js'

export function onUpload (data) {
	return request(api.Upload, 'POST', data)
}

export function onUpload2 (data) {
	return request(api.Upload, 'POST', data)
}

export function getAreaList () {
	return request(api.AreaList, 'GET')
}

export function getAllArea () {
	return request(api.AllAreaList, 'GET')
}

export function getProjectList (params) {
	return request(api.ProjectList, 'GET', params)
}

export function getProjectList2 (id, params) {
	return request(`${api.ProjectList2}?areaId=${id}${params}`, 'POST')
}

export function addProject (data) {
	return request(api.AddProject, 'POST', data)
}

export function onPreview2 (key) {
	return request(`${api.PreviewMedia2}?fileKey=${key}`, 'GET')
}

export function getChildren (id) {
	return request(`${api.GetChildrenArea}?areaId=${id}`, 'GET')
}

export function detailProject (id) {
  return request(`${api.ProjectDetail}/${id}`, 'GET')
}

export function deviceDetail (deviceNo) {
  return request(`${api.GetDeviceDetail}?deviceNo=${deviceNo}&searchField=pm10`, 'POST')
}

export function deviceInfo (deviceNo) {
  return request(`${api.DeviceDetail}?deviceNo=${deviceNo}&searchField=pm10`, 'POST')
}

export function getProjectIndex () {
	return request(api.queryIndexProjectList, 'GET')
}

export function getProjectIndexId (id) {
	return request(`${api.queryIndexProjectListId}/${id}`, 'GET')
}

export function getGroupList (params) {
	return request(api.GroupProject, 'GET', params)
}
